var __extends =
    (this && this.__extends) ||
    (function () {
      var t = function (e, i) {
        return (t =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (t, e) {
              t.__proto__ = e;
            }) ||
          function (t, e) {
            for (var i in e)
              Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
          })(e, i);
      };
      return function (e, i) {
        function a() {
          this.constructor = e;
        }
        if ("function" != typeof i && null !== i)
          throw new TypeError(
            "Class extends value " + String(i) + " is not a constructor or null"
          );
        t(e, i),
          (e.prototype =
            null === i
              ? Object.create(i)
              : ((a.prototype = i.prototype), new a()));
      };
    })(),
  TeamInvitateDialog = (function (t) {
    function e() {
      var e = t.call(this) || this;
      return (
        WebSocketService.addListener({
          caller: e,
          code: 42071,
          method: e.onLoadTeamListDataFn,
        }),
        WebSocketService.addListener({
          caller: e,
          code: 4207,
          method: e.onLoadInvitateFriendDataFn,
        }),
        WebSocketService.addListener({
          caller: e,
          code: 18231,
          method: e.onLoadFuBenPlayerDataFn,
        }),
        WebSocketService.addListener({
          caller: e,
          code: 1823,
          method: e.onLoadInvitateFriendDataFn,
        }),
        e.list_team_invate.on(Laya.Event.CLICK, e, e.onInvitateFriendAction),
        (e.list_team_invate.vScrollBarSkin = ""),
        e
      );
    }
    return (
      __extends(e, t),
      (e.showTeamListView = function (t) {
        null == this.teamInvate &&
          ((this.teamInvate = new e()), (this.teamInvate.zOrder = 1e3)),
          this.teamInvate.popup(!0),
          (this.teamInvate.label_invitate_empty_title.visible = !1),
          (this.teamInvate.jsonDict = t),
          t && "fuben" == t.type
            ? WebSocketService.send({ c: 18231 })
            : WebSocketService.send({ c: 42071, d: { pageNum: 0 } });
      }),
      (e.prototype.onLoadFuBenPlayerDataFn = function (t) {
        if (0 == t.code) {
          (this.list_team_invate.visible = !0),
            (this.label_invitate_empty_title.visible = !1),
            (this.dataArr = t.list);
          var e = void 0;
          this.dataSource = [];
          for (var i = 0; i < this.dataArr.length; i++)
            (e = {
              lable_invate_username: {
                text: this.dataArr[i].lvl + "级" + this.dataArr[i].userName,
              },
              lable_invate_friend: {
                text: this.dataArr[i].isFriend ? "好友" : "非好友",
              },
              roleId: this.dataArr[i].roleId,
              isFriend: this.dataArr[i].isFriend,
            }),
              this.dataSource.push(e);
          this.list_team_invate.dataSource = this.dataSource;
        } else
          (this.list_team_invate.visible = !1),
            (this.label_invitate_empty_title.visible = !0),
            (this.label_invitate_empty_title.text = t.msg);
      }),
      (e.prototype.onLoadTeamListDataFn = function (t) {
        if (0 == t.code) {
          (this.list_team_invate.visible = !0),
            (this.label_invitate_empty_title.visible = !1),
            (this.dataArr = t.list);
          var e = void 0;
          this.dataSource = [];
          for (var i = 0; i < this.dataArr.length; i++)
            (e = {
              lable_invate_username: {
                text: this.dataArr[i].lvl + "级" + this.dataArr[i].userName,
              },
              lable_invate_friend: {
                text: this.dataArr[i].isFriend ? "好友" : "非好友",
              },
              roleId: this.dataArr[i].roleId,
              isFriend: this.dataArr[i].isFriend,
            }),
              this.dataSource.push(e);
          this.list_team_invate.dataSource = this.dataSource;
        } else
          (this.list_team_invate.visible = !1),
            (this.label_invitate_empty_title.visible = !0),
            (this.label_invitate_empty_title.text = t.msg);
      }),
      (e.prototype.onInvitateFriendAction = function (t) {
        var e = this.list_team_invate.selectedItem;
        this.jsonDict && "fuben" == this.jsonDict.type
          ? WebSocketService.send({ c: 1823, d: { roleId: e.roleId } })
          : WebSocketService.send({
              c: 4207,
              d: { roleId: e.roleId, isFriend: e.isFriend },
            });
      }),
      (e.prototype.onLoadInvitateFriendDataFn = function (t) {
        ToastView.toastView(t.msg), t.code;
      }),
      e
    );
  })(ui.TabBarItemController.TeamInvitateDialogUI);
